
package cn.luoei.image.crop.picker;

import android.app.Activity;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReadableMap;

import cn.luoei.image.crop.picker.lib.PickerModule;

public class RNImageCropPickerModule extends ReactContextBaseJavaModule {

  private final ReactApplicationContext reactContext;

  public RNImageCropPickerModule(ReactApplicationContext reactContext) {
    super(reactContext);
    this.reactContext = reactContext;
  }

  @Override
  public String getName() {
    return "ImagePicker";
  }


  @ReactMethod
  public void openPicker(final ReadableMap options, final Promise promise) {

    PickerModule pickerModule = new PickerModule(getReactApplicationContext());
    pickerModule.openPicker(options,promise);

  }

  @ReactMethod
  public void openCropper(final ReadableMap options, final Promise promise) {

    PickerModule pickerModule = new PickerModule(getReactApplicationContext());
    pickerModule.openCropper(options,promise);

  }

  @ReactMethod
  public void openCamera(final ReadableMap options, final Promise promise) {
    PickerModule pickerModule = new PickerModule(getReactApplicationContext());
    pickerModule.openCamera(options,promise);
  }

  @ReactMethod
  public void clean(final Promise promise) {
    PickerModule pickerModule = new PickerModule(getReactApplicationContext());
    pickerModule.clean(promise);
  }

}